public function GetNofSubSections(ini, sectionname) result(count)
return number of subsections within a section of a ini db
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
type(IniList),
|
intent(in) |
|
|
:: |
ini |
|
character(len=*),
|
intent(in) |
|
|
:: |
sectionname |
|
Return Value
integer(kind=short)
Variables
Type |
Visibility | Attributes |
|
Name |
| Initial | |
integer(kind=short),
|
public |
|
:: |
i |
|
|
|
integer(kind=long),
|
public |
|
:: |
lower |
|
|
|
integer(kind=short),
|
public |
|
:: |
pos |
|
|
|
integer(kind=long),
|
public |
|
:: |
upper |
|
|
|
Source Code
FUNCTION GetNofSubSections &
( ini, sectionname ) &
RESULT (count)
IMPLICIT NONE
! function arguments
!arguments with intent(in):
TYPE (IniList), INTENT(in) :: ini
CHARACTER (LEN = *), INTENT(IN) :: sectionname
!Local scalar:
INTEGER (KIND = short) :: count
INTEGER (KIND = short) :: pos
INTEGER (KIND = short) :: i
INTEGER (KIND = long) :: lower, upper
!------------end of declaration------------------------------------------------
!search for section
DO i = 1, SIZE ( ini % sectionName)
IF ( sectionname == ini % sectionName (i) ) THEN
pos = i
EXIT
END IF
END DO
lower = ini % sectionBegin (pos)
upper = ini % sectionEnd (pos)
count = 0
DO i = 1, SIZE (ini % subSectionBegin)
IF ( ini % subSectionBegin (i) >= lower .AND. &
ini % subSectionBegin (i) <= upper ) THEN
count = count + 1
END IF
END DO
RETURN
END FUNCTION GetNofSubSections